﻿using System;
namespace Xroad.Eu.Xsd.Identifiers {
    
    
    [System.SerializableAttribute()]
    public class XRoadObjectType : global::Xtee.Core.Schema.XsdString {
        
        public const string MEMBER = "MEMBER";
        
        public const string SUBSYSTEM = "SUBSYSTEM";
        
        public const string SERVER = "SERVER";
        
        public const string GLOBALGROUP = "GLOBALGROUP";
        
        public const string LOCALGROUP = "LOCALGROUP";
        
        public const string SECURITYCATEGORY = "SECURITYCATEGORY";
        
        public const string SERVICE = "SERVICE";
        
        public const string CENTRALSERVICE = "CENTRALSERVICE";
        
        public XRoadObjectType(string value) : 
                base(value) {
            this.Validate();
            string annot = null;
            if (Value == "MEMBER") {
                annot = "MEMBER";
            }
            if (Value == "SUBSYSTEM") {
                annot = "SUBSYSTEM";
            }
            if (Value == "SERVER") {
                annot = "SERVER";
            }
            if (Value == "GLOBALGROUP") {
                annot = "GLOBALGROUP";
            }
            if (Value == "LOCALGROUP") {
                annot = "LOCALGROUP";
            }
            if (Value == "SECURITYCATEGORY") {
                annot = "SECURITYCATEGORY";
            }
            if (Value == "SERVICE") {
                annot = "SERVICE";
            }
            if (Value == "CENTRALSERVICE") {
                annot = "CENTRALSERVICE";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public XRoadObjectType() : 
                base(string.Empty) {
        }
        
        public static bool TryParse(string value, out global::Xroad.Eu.Xsd.Identifiers.XRoadObjectType result) {
            try {
                result = new global::Xroad.Eu.Xsd.Identifiers.XRoadObjectType(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator String (XRoadObjectType value) {
            return value.Value;
        }
        
        public static implicit operator XRoadObjectType (string value) {
            if (value==null) {
                return null;
            }
            return new XRoadObjectType(value);
        }
    }
}
